/*
 * @Author: 陈德基
 * @Date: 2021-11-16 09:22:47
 * @LastEditTime: 2021-11-16 09:23:23
 * @Description: 
 * @FilePath: \copy_gsy_github_app_flutter\lib\widget\app_input_widget.dart
 * 联系方式：
 * wx: melody_2009
 * qq: 7815171323 
 */
import 'package:flutter/material.dart';

/// 带图标的输入框
class AppInputWidget extends StatefulWidget {
  final bool obscureText;

  final String? hintText;

  final IconData? iconData;

  final ValueChanged<String>? onChanged;

  final TextStyle? textStyle;

  final TextEditingController? controller;

  AppInputWidget(
      {Key? key,
      this.hintText,
      this.iconData,
      this.onChanged,
      this.textStyle,
      this.controller,
      this.obscureText = false})
      : super(key: key);

  @override
  _AppInputWidgetState createState() => new _AppInputWidgetState();
}

/// State for [AppInputWidget] widgets.
class _AppInputWidgetState extends State<AppInputWidget> {
  @override
  Widget build(BuildContext context) {
    return new TextField(
      controller: widget.controller,
      onChanged: widget.onChanged,
      obscureText: widget.obscureText,
      decoration: new InputDecoration(
        hintText: widget.hintText,
        icon: widget.iconData == null ? null : new Icon(widget.iconData),
      ),
    );
  }
}
